//
//  MailXQViewController.m
//  XingRun
//
//  Created by 赵颜彬 on 17/1/12.
//  Copyright © 2017年 赵颜彬. All rights reserved.
//

#import "MailXQViewController.h"
#import "SaleHouseToolBar.h"
@interface MailXQViewController ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;

@property (nonatomic, strong)  SaleHouseToolBar *bar;


@end

@implementation MailXQViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"运动纪念T恤";
    
    [self cretableView];
    
    [self createToolBar];
}
- (void)createToolBar{
    _bar = [SaleHouseToolBar new];
    [_bar addContactTarget:self Action:@selector(chat:)];
    [self.view addSubview:_bar];
    
    _bar.frame = CGRectMake(0, self.view.bounds.size.height - 50 * HEIGHT, 375 * WIDTH, 50 * HEIGHT);
}
-(void)chat:(UIButton *)btn{
    OrderViewController *vc = [[OrderViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}


-(void)cretableView{
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, -29, self.view.bounds.size.width, self.view.bounds.size.height) style:UITableViewStyleGrouped];
    self.tableView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_tableView];
    
    _tableView.delegate = self;
    _tableView.dataSource = self;
    
    
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0) {
        MailXQTableViewCell  *cell= [[MailXQTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell1"];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;//设置
        return cell;
    }if (indexPath.section == 1) {
        MailXQNextTableViewCell *cell = [[MailXQNextTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell2"];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
    }
    return [[UITableViewCell alloc]init];

    
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0) {
        return 300 *HEIGHT;
    }if (indexPath.section == 1) {
        return 250 * HEIGHT;
    }
    return 250 * HEIGHT;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
